import VueI18n from "../language";

//模板二首页注册
export const phoneRuleHeader = {
  reg: /^[+]{0,1}(\d+)$/,
};
export const emailRuleHeader = {
  // eslint-disable-next-line no-useless-escape
  reg: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
};

export const phoneRule = {
  reg: /^[+]{0,1}(\d+)$/,
  message: VueI18n.global.t("formTip.phoneReg"),
};
export const emailRule = {
  // eslint-disable-next-line no-useless-escape
  reg: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
  message: VueI18n.global.t("formTip.emailReg"),
};

export const passwordRule = {
  // reg: /^(?![a-zA-Z]+$)(?![0-9]+$)[a-zA-Z0-9]{8,}$/,
  reg: /^(?=.*[a-zA-Z])(?=.*[0-9])[a-zA-Z0-9!"#$% & '()*+,-./:;<=>? @[\]}~^ _ ` { |]{8,}$/,
  message: VueI18n.global.t("formTip.passLimitTip"),
};

export const codeRule = {
  reg: /^\d{6}$/,
  message: VueI18n.global.t("formTip.codeReg"),
};

export const erc20Rule = {
  reg: /0x[0-9a-zA-Z]{40}/,
  message: VueI18n.global.t("formTip.walletAddressReg"),
};
export const omniRule = {
  reg: /[1,3][0-9a-zA-Z]{33}/,
  message: VueI18n.global.t("formTip.walletAddressReg"),
};
export const trc20Rule = {
  reg: /T[0-9a-zA-Z]{33}/,
  message: VueI18n.global.t("formTip.walletAddressReg"),
};
// 正数
export const positiveRule = {
  reg: /^[+]{0,1}[1-9]\d*$|^[+]{0,1}(0\.\d*[1-9])$|^[+]{0,1}([1-9]\d*\.\d*[1-9])$/,
  message: VueI18n.global.t("formTip.positiveReg"),
};
// // 危险标签警报
// export const dangerRule = {
//   reg: /<[^>]*>/g,
//   message: VueI18n.global.t("formTip.dangerTag")
// };

// 邀请码
export const inviteCodeRule = {
  reg: /^[a-zA-Z0-9]{6}$/,
  message: VueI18n.global.t("formTip.inviteCodeTip"),
};
